package com.xian.ucenter.aliyunoss.controller;

import com.xian.ucenter.aliyunoss.service.OssService;
import com.xian.ucenter.commons.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@CrossOrigin
@RestController
@RequestMapping("/ucenter/admin/oss")
public class OssController {
    @Autowired
    private OssService ossService;
    @PostMapping("/postImage")
    public Result uploadPostImage(MultipartFile file) {
        return Result.ok("url",ossService.uploadPostImage(file));
    }
    @PostMapping("/avatar")
    public Result uploadAvatar(MultipartFile file) {
        return Result.ok("url",ossService.uploadAvatarFile(file));
    }
    @PostMapping("/postCover")
    public Result uploadPostCover(MultipartFile file) {
        return Result.ok("url",ossService.uploadPostCover(file));
    }
    @PostMapping("/projectCover")
    public Result uploadProjectCover(MultipartFile file) {
        return Result.ok("url",ossService.uploadProjectCover(file));
    }
}
